#被动技能【附魔火刃】
execute as @a[tag=mingge,scores={Diamond_sword0=1..}] at @s run function nw:yingxiong/2yingxiong/08mingge/skill/0yandun

#主动技能【恶魔附身】
execute as @a[tag=mingge,scores={skEXBottle=1}] at @s run function nw:yingxiong/2yingxiong/08mingge/skill/2xuzuo
#主动技能【恶魔附身】二段：主动关闭【恶魔附身】
execute as @a[tag=mingge,scores={skEXBottle=3}] at @s run function nw:yingxiong/2yingxiong/08mingge/skill/3xuzuojieshu
#武器技能【火焰玄学】改变箭
execute as @a[tag=mingge,scores={skEXBottle=2,skBow1=1..}] at @s positioned ^ ^0.5 ^2 as @e[type=spectral_arrow,distance=0..3] run tag @s add minggeSpectralArrow
execute as @e[type=minecraft:spectral_arrow,tag=minggeSpectralArrow] run data merge entity @s {Item:{id:"minecraft:oak_button",Count:1b}}

#被动技能【恶魔附身】三段：使用【火焰玄学】结束【恶魔附身】
execute as @a[tag=mingge,scores={skEXBottle=2,skBow1=1..}] at @s run function nw:yingxiong/2yingxiong/08mingge/skill/3xuzuojieshu
#主动技能【恶魔附身】CD	
execute as @a[tag=mingge,scores={skCDEXBottle=0}] run item replace entity @s weapon.offhand with minecraft:experience_bottle{display: {Name: '[{"text":"开启技能：恶魔附身","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]', Lore: ['{"text":"主动技能【恶魔附身】","color":"dark_purple","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}', '{"text":"开启【恶魔附身】","color":"blue","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}', '{"text":"立即受到瞬间伤害I与中毒V 4s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}', '{"text":"获得【火焰玄学】与一支【恶魔化身】","color":"dark_green","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}', '{"text":"（此技能为：开关类技能）","color":"red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}']}, Enchantments: [{id: "minecraft:loyalty", lvl: 10}]} 1
scoreboard players reset @a[tag=mingge,scores={skCDEXBottle=0}] skCDEXBottle

#【恶魔化身】特效
execute as @e[type=spectral_arrow,tag=minggeSpectralArrow] at @s run particle squid_ink ~ ~0.2 ~ 0.2 0.2 0.2 0.001 2 normal @a
# ,nbt={inGround:1b}
#【恶魔化身】落地或命中墙体时燃烧
execute as @e[type=spectral_arrow,tag=minggeSpectralArrow,nbt={inGround:1b}] at @s run summon minecraft:armor_stand ~ ~ ~ {Tags:[BlackFire],CustomNameVisible:0b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,OnGround:1b,Invisible:1,Small:1,NoBasePlate:1,Rotation:[0f]}
execute as @e[type=spectral_arrow,tag=minggeSpectralArrow,nbt={inGround:1b}] at @s run kill @s

#【冥火附魔】燃烧效果
execute at @e[type=armor_stand,tag=BlackFire] run particle large_smoke ~ ~ ~ 1.2 0.2 1.2 0.01 4 normal @a
execute at @e[type=armor_stand,tag=BlackFire] run effect give @a[distance=0..3] wither 3 2 true
kill @e[type=armor_stand,tag=BlackFire,scores={skTimeKe=80..}]

#主动技能【恶魔附身】特效
execute as @a[tag=mingge,scores={skEXBottle=2}] at @s run particle witch ~ ~-0.3 ~ 0.2 0.2 0.2 0.01 20 normal @a
#主动技能【恶魔附身】效果
effect clear @a[tag=mingge,scores={skEXBottle=2}] speed
effect clear @a[tag=mingge,scores={skEXBottle=2}] levitation
effect give @a[tag=mingge,scores={skEXBottle=2}] slowness 1 2 true
effect give @a[tag=mingge,scores={skEXBottle=2}] slow_falling 1 0 true
effect give @a[tag=mingge,scores={skEXBottle=2}] hunger 1 4 true
effect give @a[tag=mingge,scores={skEXBottle=2}] resistance 1 0 true
#主动技能【恶魔附身】跳跃受到瞬间伤害
effect give @a[tag=mingge,scores={skEXBottle=2,skJump=1..}] instant_damage 1 1
scoreboard players set @a[tag=mingge,scores={skEXBottle=2,skJump=1..}] skJump 0
#主动技能【恶魔附身】清除箭特效及效果
execute at @a[tag=mingge,scores={skEXBottle=2}] at @e[type=#arrows,distance=0..3.7] run particle dragon_breath ~ ~ ~ 0.2 0.2 0.2 0.01 20 normal @a
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=#arrows,distance=0..3.7]

execute at @a[tag=mingge,scores={skEXBottle=2}] at @e[type=snowball,distance=0..3.7] run particle dragon_breath ~ ~ ~ 0.2 0.2 0.2 0.01 20 normal @a
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=snowball,distance=0..3.7]

execute at @a[tag=mingge,scores={skEXBottle=2}] at @e[type=ender_pearl,distance=0..3.7] run particle dragon_breath ~ ~ ~ 0.2 0.2 0.2 0.01 20 normal @a
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=ender_pearl,distance=0..3.7]

execute at @a[tag=mingge,scores={skEXBottle=2}] at @e[type=fireball,distance=0..3.7] run particle dragon_breath ~ ~ ~ 0.2 0.2 0.2 0.01 20 normal @a
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=fireball,distance=0..3.7]

execute at @a[tag=mingge,scores={skEXBottle=2}] at @e[type=firework_rocket,distance=0..3.7] run particle dragon_breath ~ ~ ~ 0.2 0.2 0.2 0.01 20 normal @a
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=firework_rocket,distance=0..3.7]

execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=#minecraft:arrows,distance=0..3.7]
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=snowball,distance=0..3.7]
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=ender_pearl,distance=0..3.7]
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=fireball,distance=0..3.7]
execute at @a[tag=mingge,scores={skEXBottle=2}] run kill @e[type=firework_rocket,distance=0..3.7]